package com.example.graduationdesign.pojo.vo;

import java.util.Optional;

/**
 * 邮件接收方
 */
public class EmailReceiver {
    /* 发送方 */
    private String sender;
    /* 邮件 可多人*/
    private String[] receivers;
    /* 邮件主题 */
    private String subject;
    /* 邮件内容 */
    private Content content;

    public class Content{
        /* 标题 */
        private String title;
        /* 内容 */
        private String text;
        /* 验证码 */
        private String code;
        /* 过期时间 */
        private Long expirationTime;
        public Content() {
        }

        public String getTitle() {
            return title;
        }

        public void setTitle(String title) {
            this.title = title;
        }

        public String getText() {
            return text;
        }

        public void setText(String text) {
            this.text = text;
        }

        public String getCode() {
            return code;
        }

        public void setCode(String code) {
            this.code = code;
        }

        public Long getExpirationTime() {
            return expirationTime;
        }

        public void setExpirationTime(Long expirationTime) {
            if(!Optional.ofNullable(expirationTime).isPresent() || expirationTime < 0){
                expirationTime = 2L;
            }
            this.expirationTime = expirationTime;
        }
    }
    public EmailReceiver() {
    }

    public String getSender() {
        return sender;
    }

    public void setSender(String sender) {
        this.sender = sender;
    }

    public String[] getReceivers() {
        return receivers;
    }

    public void setReceivers(String[] receivers) {
        this.receivers = receivers;
    }

    public String getSubject() {
        return subject;
    }

    public void setSubject(String subject) {
        this.subject = subject;
    }

    public Content getContent() {
        return content;
    }

    public void setContent(Content content) {
        this.content = content;
    }
}
